package com.starsoft.smdc.bean;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
 * SmdcFundamental entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "smdc_fundamental")
@Cache(usage=CacheConcurrencyStrategy.READ_WRITE, region="ormCache")
public class SmdcFundamental implements java.io.Serializable {

	// Fields

	private String secId;
	private Date divLasted;
	private Date erLasted;
	private Date divLastUpdate;
	private Date erLastUpdate;
	private Set<SmdcDiv> smdcDivs = new HashSet<SmdcDiv>(0);
	private Set<SmdcEr> smdcErs = new HashSet<SmdcEr>(0);

	// Constructors

	/** default constructor */
	public SmdcFundamental() {
	}

	/** minimal constructor */
	public SmdcFundamental(String secId) {
		this.secId = secId;
	}

	/** full constructor */
	public SmdcFundamental(String secId, Date divLasted, Date erLasted, Date divLastUpdate, Date erLastUpdate,
			Set<SmdcDiv> smdcDivs, Set<SmdcEr> smdcErs) {
		this.secId = secId;
		this.divLasted = divLasted;
		this.erLasted = erLasted;
		this.divLastUpdate = divLastUpdate;
		this.erLastUpdate = erLastUpdate;
		this.smdcDivs = smdcDivs;
		this.smdcErs = smdcErs;
	}

	// Property accessors
	@Id
	@Column(name = "secId", unique = true, nullable = false, length = 10)
	public String getSecId() {
		return this.secId;
	}

	public void setSecId(String secId) {
		this.secId = secId;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "div_lasted", length = 10)
	public Date getDivLasted() {
		return this.divLasted;
	}

	public void setDivLasted(Date divLasted) {
		this.divLasted = divLasted;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "er_lasted", length = 10)
	public Date getErLasted() {
		return this.erLasted;
	}

	public void setErLasted(Date erLasted) {
		this.erLasted = erLasted;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "div_last_update", length = 10)
	public Date getDivLastUpdate() {
		return this.divLastUpdate;
	}

	public void setDivLastUpdate(Date divLastUpdate) {
		this.divLastUpdate = divLastUpdate;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "er_last_update", length = 10)
	public Date getErLastUpdate() {
		return this.erLastUpdate;
	}

	public void setErLastUpdate(Date erLastUpdate) {
		this.erLastUpdate = erLastUpdate;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "id.secId")
	@Cache(usage=CacheConcurrencyStrategy.READ_WRITE, region="ormCache")
	public Set<SmdcDiv> getSmdcDivs() {
		return this.smdcDivs;
	}

	public void setSmdcDivs(Set<SmdcDiv> smdcDivs) {
		this.smdcDivs = smdcDivs;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "id.secId")
	@Cache(usage=CacheConcurrencyStrategy.READ_WRITE, region="ormCache")
	public Set<SmdcEr> getSmdcErs() {
		return this.smdcErs;
	}

	public void setSmdcErs(Set<SmdcEr> smdcErs) {
		this.smdcErs = smdcErs;
	}

}